# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=make
pkgver=4.4.1
pkgrel=2
pkgdesc="GNU make utility to maintain groups of programs"
url="https://www.gnu.org/software/make"
arch="all"
license="GPL-3.0-or-later"
subpackages="$pkgname-doc"
source="https://ftp.gnu.org/gnu/make/make-$pkgver.tar.gz"

build() {
	if [ -z "$BOOTSTRAP" ]; then
		export CFLAGS="$CFLAGS -flto=auto"
	fi
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--disable-nls
	make
}

check() {
	[ "$CBUILD" != "$CHOST" ] || (ulimit -n 64 && PERL5LIB=. make check)
}

package() {
	make DESTDIR="$pkgdir" install
	ln -sfv make "$pkgdir"/usr/bin/gmake
}

sha512sums="
145260cbd6a8226cef3dfef0c8baba31847beaebc7e6b65d39d02715fd4f4cab9b139b6c3772e550088d4f9ae80c6d3ed20b9a7664c693644dfb96b4cb60e67c  make-4.4.1.tar.gz
"
